# Importing Data
GHANA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "N1:N229")

# Checking the Imported Data
View(GHANA)
# Creating Time Series Data
GHANA_ts <- ts(GHANA, start=c(1998,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
GHANA_ts
sum(is.na(GHANA_ts))
library(forecast)
GHANA_ts <- tsclean(GHANA_ts)
GHANA_ts

# Identification: Plotting the Time Series Data
plot(GHANA_ts)

# Estimating the appropriate model
GHANA_ts_model <- auto.arima(GHANA_ts)
GHANA_ts_model

# Forecasting
options(max.print=1000000)
GHANA_ts_forecast <- forecast (GHANA_ts_model, level=c(95), h=288)
plot(GHANA_ts_forecast)
GHANA_ts_forecast             

# Exporting
write.table(GHANA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/GHANA_TSA.csv", sep=",")
